//package com.applet.filter;
//
//import org.springframework.cloud.gateway.filter.GatewayFilterChain;
//import org.springframework.cloud.gateway.filter.GlobalFilter;
//import org.springframework.core.Ordered;
//import org.springframework.http.HttpStatus;
//import org.springframework.web.server.ServerWebExchange;
//import reactor.core.publisher.Mono;
//
///**
// * my name is kiki ,2019/8/26.
// * gateway过滤
// */
////@Configuration
//public class TokenFilter implements GlobalFilter, Ordered {
//
//    @Override
//    public int getOrder() {
//        return -100;
//    }
//
//    @Override
//    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
//        String token = exchange.getRequest().getQueryParams().getFirst("token");
//        //url不含token参数时返回401状态码
//        if (token == null || token.isEmpty()) {
//            exchange.getResponse().setStatusCode(HttpStatus.UNAUTHORIZED);
//            return exchange.getResponse().setComplete();
//        }
//       // exchange.mutate().request(build).build();
//        return chain.filter(exchange);
//    }
//}
